heap operations
Advanced
wA heap is a particular organization of elements in a range between two random access iterators [a, b). Its two key properties are:
w
w1. *a is the largest element in the range.
w2. *a may be removed by the pop_heap algorithm, or a new element can be added by the push_heap
w algorithm, in O(logN) time.
w
wThese properties make heaps useful as priority queues.
wThe heap algorithms use less than (operator<) as the default comparison. In all of the algorithms, an alternate comparison operator can be specified.